﻿using EditorialProyectos.Business.Entities;
using EditorialProyectos.DataAccess.Core;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;

namespace EditorialProyectos.Business
{
    public class ManagerFactory
    {
        private static AuditLogManager _auditLogManager;
        public static ApplicationUserManager _aplicationUserManager;
        private static ProjectManager _projectManager;
        private static BenefitManager _benefitManager;
        private static CommentManager _commentManager;
        private static InvestmentManager _investmentManager;
        private static VoteManager _voteManager;
        private static CategoryManager _categoryManager;

        public static ApplicationUserManager _ApplicationUserManager;
        public static RoleManager<ApplicationRole> _roleManager;

        public static AuditLogManager AuditLogManager { get { return _auditLogManager ?? (_auditLogManager = new AuditLogManager()); } }


        public static ProjectManager ProjectManager { get { return _projectManager ?? (_projectManager = new ProjectManager()); } }
        public static BenefitManager BenefitManager { get { return _benefitManager ?? (_benefitManager = new BenefitManager()); } }
        public static CommentManager CommentManager { get { return _commentManager ?? (_commentManager = new CommentManager()); } }
        public static InvestmentManager InvestmentManager { get { return _investmentManager ?? (_investmentManager = new InvestmentManager()); } }
        public static VoteManager VoteManager { get { return _voteManager ?? (_voteManager = new VoteManager()); } }
        public static CategoryManager CategoryManager { get { return _categoryManager ?? (_categoryManager = new CategoryManager()); } }

        public static ApplicationUserManager ApplicationUserManager { get { return _ApplicationUserManager ?? (_ApplicationUserManager = new ApplicationUserManager(new UserStore<ApplicationUser>(ApplicationContext.DataContext))); } set { _ApplicationUserManager = value; } }
        public static RoleManager<ApplicationRole> RoleManager { get { return _roleManager ?? (_roleManager = new RoleManager<ApplicationRole>(new RoleStore<ApplicationRole>(ApplicationContext.DataContext))); } }
    }
}
